﻿using orm.sqlsugar.api.Interface;
using SqlSugar;

namespace orm.sqlsugar.api.Entities
{
    /// <summary>
    /// 订单实体类
    /// </summary>
    public class Order : ISoftDelete
    {
        public int Id { get; set; }

        public string Number { get; set; } = null!; // 告诉编译器这个属性我确定不会为 null

        public decimal TotalPrice { get; set; }

        public DateTime CreateTime { get; set; }

        public bool IsDeleted { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(OrderDetail.OrderId))]
        public List<OrderDetail> OrderDetails { get; set; } // 要用 List 且不能赋默认值
    }

    /// <summary>
    /// 订单明细实体类
    /// </summary>
    public class OrderDetail
    {
        public int Id { get; set; }

        public int OrderId { get; set; }

        public string ProductName { get; set; } = null!;

        public decimal ProductPrice { get; set; }

        public DateTime CreateTime { get; set; }
    }
}
